﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BeardCoder.Data.Framework
{
    public interface IEntity<T>
    {
        T Id { get; }
    }

    public abstract class Entity<T> : IEntity<T>
    {
        public virtual T Id
        {
            get;
            protected set;
        }

        public virtual bool IsTransient()
        {
            return Id.Equals(default(T)) || this.Id == null;
        }
    }

    [Serializable]
    public abstract class Entity : Entity<int>
    {
        public override bool IsTransient()
        {
            return Id == default(int);
        }
    }
}
